package it.producer;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:spring-rabbitmq-producer.xml")
public class Topic {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Test
    public void TopicTest(){

        rabbitTemplate.convertAndSend("spring_topic_exchange","heima.#","hello1 Topic");
        rabbitTemplate.convertAndSend("spring_topic_exchange","itcast.*","hello2 Topic");
    }
}
